package mt.exam.stream;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

public class Center {


    public static void main(String[] args) {
        List<Person> personList = new ArrayList<Person>();
        personList.add(new Person("Tom", 8900,20,"male", "New York"));
        personList.add(new Person("Jack", 7000, 30,"male", "Washington"));
        personList.add(new Person("Lily", 7800, 20,"female", "Washington"));
        personList.add(new Person("Anni", 8200, 50,"female", "New York"));
        personList.add(new Person("Owen", 9500, 80,"male", "New York"));
        personList.add(new Person("Alisa", 7900, 90,"female", "New York"));

      //  Optional<String> collect = personList.stream().filter((e) -> e.getSalary() > 8000).map(Person::getName).max(Comparator.comparing(String::length));

        personList.stream().map(person->{
            person.setSalary(person.getSalary()+10000);
            return person;
        }).forEach(e->{
            System.out.println(e.getSalary());
        });

       // System.out.println(collect);
    }
}
